<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<title>修改个人信息</title>
		<link rel="stylesheet" href="__PUBLIC__/css/weui.min.css" />
		<link rel="stylesheet" href="__PUBLIC__/css/example.css" />
		<link rel="stylesheet" href="__PUBLIC__/css/jquery-weui.css" />
		<style type="text/css">
			.weui_select_apply {
				-webkit-appearance: none;
				border: 0;
				outline: 0;
				background-color: transparent;
				width: 100%;
				font-size: inherit;
				position: relative;
				z-index: 1;
			}
		</style>
	</head>

	<body ontouchstart>
		<div class="container">
			<div class="hd">
				<h1 class="page_title">修改个人信息</h1>
			</div>
			<div class="bd">
				<div class="weui_cells_title">请正确填写个人信息</div>
				<div class="weui_cells weui_cells_form">
					<div class="weui_cell">
						<div class="weui_cell_hd"><label class="weui_label">姓名</label></div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="name" type="text" maxlength="6" value="{$info.name}" required="required" />
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd"><label class="weui_label">学号</label></div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="number" type="number" maxlength="10" value="{$info.number}" required="required" />
						</div>
					</div>
					<div class="weui_cell ">
						<div class="weui_cell_hd">
							<label class="weui_label">班级</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<select class="weui_select_apply" id="banji1">
								<?php $noclass = false;?>
								<foreach name="banji" item="banji">
									<if condition="($banji['class'] eq $info['class'])">
										<?php $noclass = ture;?>  
										<option value="{$banji.class}" selected="selected">{$banji.class}</option>
									<else /> 
										<option value="{$banji.class}">{$banji.class}</option>	
									</if>
								</foreach>
								<if condition="(!$noclass)">
									<option value="{$info.class}" selected="selected">{$info.class}</option>
								</if>
								<option value="otherclass">其他班级</option>
							</select>
						</div>
					</div>
				</div>
				<div class="weui_cells_title" id="otherClassAreaTitle" style="display: none;">请正确手动填写班级</div>
				<div class="weui_cells weui_cells_form">
					<div class="weui_cell" id="otherClassAreaInput" style="display: none;">
						<div class="weui_cell_hd"><label class="weui_label">班级</label></div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="otherClassValue" type="text" maxlength="6" value="" required="required" />
						</div>
					</div>
				</div>
				<div class="weui_btn_area">
					<a href="javascript:;" class="weui_btn weui_btn_primary" id="changeSure">确定</a>
				</div>
			</div>
		</div>
		<div class="weui_msg" style="display: none;">
			<div class="weui_icon_area do_success"><i class="weui_icon_success weui_icon_msg"></i></div>
			<div class="weui_icon_area do_failure" style="display: none;"><i class="weui_icon_warn weui_icon_msg"></i></div>
			<div class="weui_text_area">
				<h2 class="weui_msg_title do_success">操作成功</h2>
				<p class="weui_msg_desc do_failure">信息修改成功</p>
			</div>
			<div class="weui_opr_area">
				<p class="weui_btn_area">
					<a href="javascript:;" class="weui_btn weui_btn_primary" id="yes">确定</a>
				</p>
			</div>
			<div class="weui_extra_area">
				<a href="javascript:;">查看详情</a>
			</div>
		</div>
	</body>

</html>
<script src="__PUBLIC__/js/zepto.min.js"></script>
<script src="__PUBLIC__/js/jquery-weui.js"></script>
<script src="__PUBLIC__/js/example.js"></script>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
	$("#changeSure").click(function(event){
        var name = $("#name").val();
		var number = $("#number").val();
		var banji = $("#banji1").val();
		if(banji == "otherclass")
			var banji = $("#otherClassValue").val();
		if(number.length != 10){
			alert('学号必须是10位数');
 			return false;
  		}
  		if(banji.indexOf("班")>0){
  			alert('填写的班级的格式不对，正确格式 "国商1401"');
  			return false;
  		}
  		url = "{:U('Index/handlechangePersonInfo')}";
  		/*url = "http://12.testet.sinaapp.com/index.php/Index/handlechangePersonInfo";*/
  		data = {
  			name:name,
  			number:number,
  			banji:banji
  		};
  		$.post(url,data,
		function(data,states){
			$('.container').hide();
			$(".weui_msg ").show();
		});
	});
	$("#yes").click(function(e) {
		wx.closeWindow();
	});
	$("select").change(function(e){
		if($(this).val() == "otherclass"){
			$("#otherClassAreaTitle").show();
			$("#otherClassAreaInput").show();	
		}else{
			$("#otherClassAreaTitle").hide();
			$("#otherClassAreaInput").hide();
		}
	});
			
	 
	
</script>